package id.chen;

import id.chen.faces.*;

public class Cube {
	int dimension=3;
	Face[] faces=new Face[6];
	
	public Cube(int dimension){
		this.dimension=dimension;
		faces[FaceFront.INDEX]=new FaceFront(dimension,'B');
		faces[FaceBack.INDEX]=new FaceBack(dimension,'G');
		faces[FaceUp.INDEX]=new FaceUp(dimension,'Y');
		faces[FaceDown.INDEX]=new FaceDown(dimension,'W');
		faces[FaceLeft.INDEX]=new FaceLeft(dimension,'O');
		faces[FaceRight.INDEX]=new FaceRight(dimension,'R');
		
		//set adjacent sides w.r.t. a side
		
			//front side
		faces[FaceFront.INDEX].setNorth(faces[FaceUp.INDEX]);
		faces[FaceFront.INDEX].setEast(faces[FaceRight.INDEX]);
		faces[FaceFront.INDEX].setSouth(faces[FaceDown.INDEX]);
		faces[FaceFront.INDEX].setWest(faces[FaceLeft.INDEX]);

			//back side
		faces[FaceBack.INDEX].setNorth(faces[FaceUp.INDEX]);
		faces[FaceBack.INDEX].setEast(faces[FaceLeft.INDEX]);
		faces[FaceBack.INDEX].setSouth(faces[FaceDown.INDEX]);
		faces[FaceBack.INDEX].setWest(faces[FaceRight.INDEX]);
		
			//top side
		faces[FaceUp.INDEX].setNorth(faces[FaceBack.INDEX]);
		faces[FaceUp.INDEX].setEast(faces[FaceRight.INDEX]);
		faces[FaceUp.INDEX].setSouth(faces[FaceFront.INDEX]);
		faces[FaceUp.INDEX].setWest(faces[FaceLeft.INDEX]);
		
			//bottom side
		faces[FaceDown.INDEX].setNorth(faces[FaceFront.INDEX]);
		faces[FaceDown.INDEX].setEast(faces[FaceRight.INDEX]);
		faces[FaceDown.INDEX].setSouth(faces[FaceBack.INDEX]);
		faces[FaceDown.INDEX].setWest(faces[FaceLeft.INDEX]);
		
			//left side
		faces[FaceLeft.INDEX].setNorth(faces[FaceUp.INDEX]);
		faces[FaceLeft.INDEX].setEast(faces[FaceFront.INDEX]);
		faces[FaceLeft.INDEX].setSouth(faces[FaceDown.INDEX]);
		faces[FaceLeft.INDEX].setWest(faces[FaceBack.INDEX]);
		
			//right side
		faces[FaceRight.INDEX].setNorth(faces[FaceUp.INDEX]);
		faces[FaceRight.INDEX].setEast(faces[FaceBack.INDEX]);
		faces[FaceRight.INDEX].setSouth(faces[FaceDown.INDEX]);
		faces[FaceRight.INDEX].setWest(faces[FaceFront.INDEX]);
		
		
	}

	public int getDimension() {
		// TODO Auto-generated method stub
		return this.dimension;
	}

	public Face[] getFaces() {
		return faces;
	}

	public void setFaces(Face[] faces) {
		this.faces = faces;
	}
	
	

	
}
